<template>
    <div>
        <h2>子级组件</h2>
        <h4>age1111:{{age}}</h4>
        <h4>length:{{length}}</h4>
    </div>
</template>
<script lang="ts">
import { defineComponent, computed, toRef, Ref } from 'vue'
function getLength(age:Ref) {
    return computed(() => {
        return age.value.toString().length
    })
}
export default defineComponent({
    name: 'Child',
    props: {
        age: {
            type: Number,
            required: true,
        },
    },
    setup(props) {
        const length = getLength(toRef(props, 'age'))
        return {
            length
        }
    },
})
</script>
<style>
</style>